<?php


namespace app\index\controller;


use app\common\lib\Util;

class Send
{
    public function index()
    {
        $phoneNum = intval($_GET['phone_num']);
        if(empty($phoneNum)){
            return Util::show(config('code.error'), 'error');
        }

        $code = rand(1000,9999);

        $taskData = [
          'method' => 'sendSms',
          'data' => [
              'phone' => $phoneNum,
              'code' => $code
          ]
        ];

        $_POST['http_server']->task($taskData);
        return Util::show(config('code.success'), 'ok');
    }
}